package com.asd.system.mapper;


import com.asd.system.entity.Images;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component
public interface ImagesMapper extends BaseMapper<Images> {


    @Select("SELECT viceEchoPath FROM images WHERE pid =#{pid}")
    List<String> findViceEchoPathByPid(@Param("pid") String pid);

    @Select("SELECT primaryEchoPath FROM images WHERE pid =#{pid}")
    List<String> findprimaryEchoPathByPid(String pid);



    @Delete("delete from images where primaryEchoPath = #{primaryEchoPath}")
    void deletByPrimaryEchoPath(@Param("primaryEchoPath") String primaryEchoPath);

    @Delete("delete from images where viceEchoPath = #{viceEchoPath}")
    void deletByViceEchoPath(@Param("viceEchoPath") String viceEchoPath);



    @Update("UPDATE images SET pid = #{pid} WHERE primaryEchoPath = #{primaryEchoPath}")
    void updateByPrimaryEchoPath(@Param("pid")String pid, @Param("primaryEchoPath")String primaryEchoPath);

    @Update("UPDATE images SET pid = #{pid} WHERE viceEchoPath = #{viceEchoPath}")
    void updateByViceEchoPath(@Param("pid")String pid, @Param("viceEchoPath")String viceEchoPath);


}
